import cv2
import numpy as np
img=cv2.imread('CV-Pictures/contours.bmp')
gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
ret,binary=cv2.threshold(gray,127,255,cv2.THRESH_BINARY)
contours,hierarchy=cv2.findContours(binary,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
co=img.copy()
r=cv2.drawContours(co,contours,1,(0,0,255),3)
cv2.imshow('img',img)
cv2.imshow('contours',r)
print(img.shape)
cv2.waitKey()
cv2.destroyAllWindows()